var socket = new WebSocket('ws://js.s.tansuyun.cn:8251');
if(socket.readyState!==1){
    alert("未连接。");
}
function openLED() {
    // 发送一个初始化消息
    var data = {
        events: 'OPEN_LIGHT',
        status: 'OPEN',
        styleLED: 'none'
    };
    socket.send(JSON.stringify(data))
}

function closeLED() {
    // 发送一个初始化消息
    var data = {
        events: 'CLOSE_LIGHT',
        status: 'CLOSE',
        styleLED: "block"
    };
    socket.send(JSON.stringify(data))
}

function flicker() {
    var ipt = document.getElementById('setTime');//获取input的节点
    var LateTime = ipt.value;//获取input的值
    var data = {
        events: 'FLICKER_LIGHT',
        status: 'flicker',
        lateTime: LateTime
    };
    socket.send(JSON.stringify(data));
}




